<template>
  <div>
    <el-row :gutter="15">
      <el-form ref="elForm" :model="formData" :rules="rules" size="mini" label-width="100px">
        <el-col :span="6">
          
              <el-form-item label="状态" prop="status">
                <el-select v-model="formData.status"
                 v-on:change="submitForm"
                 placeholder="请选择状态" clearable :style="{width: '100%'}">
                  <el-option v-for="(item, index) in statusOptions" :key="index" :label="item.label"
                    :value="item.value" :disabled="item.disabled"></el-option>
                </el-select>
              </el-form-item>
            
        </el-col>
        <el-col :span="6">
          
              <el-form-item label="计费" prop="caculateMethod">
                <el-select v-model="formData.caculateMethod"
                 v-on:change="submitForm"
                  placeholder="请选择计费" clearable
                  :style="{width: '100%'}">
                  <el-option v-for="(item, index) in priceMethodOptions" :key="index" :label="item.label"
                    :value="item.value" :disabled="item.disabled"></el-option>
                </el-select>
              </el-form-item>
            
        </el-col>
        <el-col :span="6">
           
              <el-form-item label="平台" prop="adtype">
                <el-select v-model="formData.adtype"
                 v-on:change="submitForm"
                  placeholder="请选择平台" clearable :style="{width: '100%'}">
                  <el-option v-for="(item, index) in adtypeOptions" :key="index" :label="item.label"
                    :value="item.value" :disabled="item.disabled"></el-option>
                </el-select>
              </el-form-item>
          
        </el-col>
       
        <el-col :span="7">
          
              <el-form-item label="投放时间" prop="worktime">
                <el-radio-group v-model="formData.worktime"
                 v-on:change="submitForm"
                  size="medium">
                  <el-radio v-for="(item, index) in worktimeOptions" :key="index" :label="item.value"
                    :disabled="item.disabled">{{item.label}}</el-radio>
                </el-radio-group>
              </el-form-item>
           
        </el-col>
        <el-col :span="9">
           
              <el-form-item label="日期范围" prop="timelimit">
                <el-date-picker type="daterange" v-model="formData.timelimit" format="yyyy-MM-dd"
                  value-format="yyyy-MM-dd" :style="{width: '100%'}" start-placeholder="开始日期"
                   v-on:change="submitForm"
                  end-placeholder="结束日期" range-separator="至" clearable></el-date-picker>
              </el-form-item>
            
        </el-col>
        <el-col :span="5">
          
              <el-form-item label="物料类型" prop="medias">
                <el-select v-model="formData.medias"
                 v-on:change="submitForm"
                  placeholder="请选择物料类型" clearable :style="{width: '100%'}">
                  <el-option v-for="(item, index) in mediasOptions" :key="index" :label="item.label"
                    :value="item.value" :disabled="item.disabled"></el-option>
                </el-select>
              </el-form-item>
           
        </el-col>
         <el-col :span="1">
             <el-button type="primary" size="mini" @click="submitForm"> 搜索 </el-button>
        </el-col>

      </el-form>
    </el-row>
  </div>
</template>
<script>
export default {
  components: {},
  props: [],
  data() {
    return {
      formData: {
        status: 0,
        caculateMethod: 0,
        placeType: 0,
        adtype: 0,
        worktime: 0,
        timelimit: 0,
        medias: 0,
      },
      rules: {},
      statusOptions: [{
        "label": "全部状态",
        "value": 0
      }, {
        "label": "待投放",
        "value": 1
      }, {
        "label": "正在投放",
        "value": 2
      }, {
        "label": "暂停",
        "value": 3
      }, {
        "label": "结束投放",
        "value": 9
      }],
      priceMethodOptions: [{
        "label": "全部",
        "value": 0
      }, {
        "label": "CPD",
        "value": 1
      }, {
        "label": "CPM",
        "value": 2
      }, {
        "label": "CPC",
        "value": 3
      }],
      adtypeOptions: [{
        "label": "全部",
        "value": 0
      }, {
        "label": "PC",
        "value": 1
      }, {
        "label": "移动网页",
        "value": 2
      }, {
        "label": "APP应用",
        "value": 3
      }],
      placeTypeOptions: [{
        "label": "全部",
        "value": 0
      }, {
        "label": "嵌入",
        "value": 1
      }, {
        "label": "悬浮",
        "value": 2
      }, {
        "label": "开屏",
        "value": 3
      }],
      worktimeOptions: [{
        "label": "不限",
        "value": 1
      }, {
        "label": "设置投放时间",
        "value": 2
      }],
      mediasOptions: [{
        "label": "全部",
        "value": 0
      }, {
        "label": "文字广告",
        "value": 1
      }, {
        "label": "图片广告",
        "value": 2
      }, {
        "label": "Flash广告",
        "value": 3
      }, {
        "label": "富媒体",
        "value": 4
      }, {
        "label": "视频广告",
        "value": 5
      }],
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    submitForm() {
      this.$refs['elForm'].validate(valid => {
        if (!valid) return
        // TODO 提交表单
        this.$emit("onselectchange", this.formData)
         
      })
    },
    resetForm() {
      this.$refs['elForm'].resetFields()
    },
  }
}

</script>
<style>
</style>

